package cn.stylefeng.guns.modular.emergency.pojo.response;

import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.tree.factory.base.AbstractTreeNode;
import lombok.Data;

import java.util.List;

/**
 * ┌─┐       ┌─┐ + +
 * ┌──┘ ┴───────┘ ┴──┐++
 * │                 │
 * │       ───       │++ + + +
 * ███████───███████ │+
 * │                 │+
 * │       ─┴─       │
 * │                 │
 * └───┐         ┌───┘
 * │         │
 * │         │   + +
 * │         │
 * │         └──────────────┐
 * │                        │
 * │                        ├─┐
 * │                        ┌─┘
 * │                        │
 * └─┐  ┐  ┌───────┬──┐  ┌──┘  + + + +
 * │ ─┤ ─┤       │ ─┤ ─┤
 * └──┴──┘       └──┴──┘  + + + +
 * 神兽保佑
 * 代码无BUG!
 */
@Data
public class TreeEmergencyTypeInfo implements AbstractTreeNode<TreeEmergencyTypeInfo> {

    /**
     * id  唯一主键
     */
    @ChineseDescription("id")
    private Long id;
    /**
     * 数据id
     */
    @ChineseDescription("数据id")
    private Long dataId;
    /**
     *名称
     */
    @ChineseDescription("名称")
    private String categoryName;
    /**
     * 层级
     */
    @ChineseDescription("层级")
    private String level;
    /**
     * 直接父类型id
     */
    @ChineseDescription("直接父类型id")
    private Long directParentTypeId;
    /**
     * tree子节点
     */
    @ChineseDescription("tree子节点")
    private List<TreeEmergencyTypeInfo> children;

    /**
     * 获取节点id
     *
     * @return 节点的id标识
     * @author fengshuonan
     * @date 2020/10/15 15:28
     */
    @Override
    public String getNodeId() {
        if (this.id == null) {
            return null;
        } else {
            return this.id.toString();
        }
    }

    /**
     * 获取节点父id
     *
     * @return 父节点的id
     * @author fengshuonan
     * @date 2020/10/15 15:28
     */
    @Override
    public String getNodeParentId() {
        if (this.directParentTypeId == null) {
            return null;
        } else {
            return this.directParentTypeId.toString();
        }
    }

    /**
     * 设置children
     *
     * @param linkedList 设置节点的子节点
     * @author fengshuonan
     * @date 2020/10/15 15:28
     */
    @Override
    public void setChildrenNodes(List<TreeEmergencyTypeInfo> linkedList) {
        this.children = linkedList;
    }

}
